<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>新经资讯后台管理</title>
    <link rel="stylesheet" type="text/css" href="../../static/admin/css/reset.css">
    <link rel="stylesheet" type="text/css" href="../../static/admin/css/main.css">
    <link rel="stylesheet" href="../../static/admin/css/jquery.pagination.css">
    <script type="text/javascript" src="../../static/admin/js/jquery-1.12.4.min.js"></script>
    <script type="text/javascript" src="../../static/admin/js/jquery.pagination.min.js"></script>
</head>
<body>
<div class="breadcrub">
    当前位置：新闻管理>新闻审核
    <form class="news_filter_form" action="{{ url_for("bp_admin.news_review") }}", method="POST">
        <input type="text" placeholder="请输入关键字" name="searchname" class="input_txt">
        <input type="submit" value="搜 索" class="input_sub">
    </form>
</div>
<div class="pannel">
    <table class="common_table">
        <tr>
            <th width="3%">id</th>
            <th width="70%">标题</th>
            <th width="15%">发布时间</th>
            <th width="5%">状态</th>
            <th width="8%">管理操作</th>
        </tr>

        {% for news in collections -%}
            <tr>
                <td>{{ news.id }}</td>
                <td class="tleft">{{ news.title }}</td>
                <td>{{ news.create_time }}</td>
                <td>{{ news.status_str }}</td>
                <td>
                    <a href="/admin/news_review_detail?newsid={{ news.id }}" class="review">审核</a>
                </td>
            </tr>
        {%- endfor %}
    </table>
</div>

<div class="box">
    <div id="pagination" class="page"></div>
</div>

<script>
    $(function () {

        // 分页功能
        $("#pagination").pagination({
            currentPage: {{ curr_page }},
            totalPage: {{ total_page }},
            callback: function (current) {
                //window.location.href = "users/follow_list/" + current
                $.ajax({
                    type: "GET",
                    url: "news_review?page=" + current,
                    dataType: "json",
                    success: function (resp) {
                        //拼接html(这个部分根据自己的需求去实现)
                        totalPage = resp.total_page;
                        var collections = resp.collections;
                        //console.log(users);
                        var htm = '<tr><th width="3%">id</th><th width="70%">标题</th><th width="15%">发布时间</th><th width="5%">状态</th><th width="8%">管理操作</th></tr>';

                        collections.forEach(function (elem) {
                            htm += '<tr><td>'  + elem.id +  '</td><td class="tleft">'  + elem.title;
                            htm += '</td><td>'  + elem.create_time +  '</td><td>'  + elem.status_str;
                            htm += '</td><td><a href="/admin/news_review_detail?newsid='  + elem.id +  '" class="review">审核</a></td></tr>';
                        });

                        $('.common_table').html(htm)
                    }
                });
            }
        });
    });
</script>


</body>
</html>